using System.Collections.Generic;
using NHibernate;
using NHibernate.Criterion;

namespace Project.Library.NHibernate
{
    public interface IQueryBatcher
    {
        /// <summary>
        /// Register a DetachedCriteria for batching.
        /// </summary>
        /// <param name="queryName">Name of the query.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        IQueryBatcher AddQuery(string queryName, DetachedCriteria criteria);

        /// <summary>
        /// Register a DetachedCriteria for batching.
        /// </summary>
        /// <param name="queryName">Name of the query.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        IQueryBatcher AddQuery(string queryName, ICriteria criteria);

        /// <summary>
        /// Returns the result enumeration corresponding to the queryName.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="queryName">Name of the query.</param>
        /// <returns></returns>
        IEnumerable<T> GetListResult<T>(string queryName);

        /// <summary>
        /// Returns the result corresponding to the queryName.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="queryName">Name of the query.</param>
        /// <returns></returns>
        T GetUniqueResult<T>(string queryName);
    }
}